import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Scanner;

public class testwork3 {
    //旧键盘 (20)
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String a = in.nextLine();
            String b = in.nextLine();
            dele(a,b);
        }
    }
    public static void dele(String a,String b){
        a=a.toUpperCase();
        b=b.toUpperCase();
        HashSet<Character>  set=new HashSet<>();
        HashSet<Character>  set1=new HashSet<>();
        for (int i = 0; i <b.length() ; i++) {
            set.add((b.charAt(i)));
        }
        for (int i = 0; i <a.length() ; i++) {
            if(!set.contains(a.charAt(i))&&!set1.contains(a.charAt(i))){
                System.out.print(a.charAt(i));
                set1.add(a.charAt(i));
            }
        }
    }
}
